﻿using System;
using System.Collections.Generic;
using System.Text;

namespace NetRosApp.Infrastructure.Interface.Base
{
    public static class HelperUtility
    {
        const string NAppUrlHelpObject = "http://pomoc.linijakoda.com/linkovi.php?application=NApp&object=";
        const string NAppUrlHelpReport = "http://pomoc.linijakoda.com/linkovi.php?application=NAppReporti&object=";

        public static void OpenHelp(string ObjectName)
        {
            OpenHelp(ObjectName, false);
        }

        public static void OpenHelp(string ObjectName, bool Report)
        {
            string OpenURL = "";


            if (Report)
            {

                OpenURL = System.Configuration.ConfigurationManager.AppSettings["NAppUrlHelpReport"];

                if (OpenURL == null) OpenURL = NAppUrlHelpReport;


            }
            else
            {


                OpenURL = System.Configuration.ConfigurationManager.AppSettings["NAppUrlHelpObject"];

                if (OpenURL == null) OpenURL = NAppUrlHelpObject;


            }
            if (!String.IsNullOrEmpty(ObjectName))
            {
                try
                {
                    System.Diagnostics.Process.Start(OpenURL + ObjectName);
                }
                catch
                {
                    //U slucaju ako nesto zeze
                    ;
                }
            }


        }
    }
}

